﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UAC;

namespace UACManager
{
    public partial class DocFieldDefForm : Form
    {
        private int documentDefId;
        public DocFieldDefForm(int documentDefId)
        {
            InitializeComponent();
            this.documentDefId = documentDefId;
            this.tDocDefID.Text = this.documentDefId.ToString();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                string _name = tName.Text;
                string _desc = tDesc.Text;
                if (string.IsNullOrEmpty(_name))
                {
                    MessageBox.Show("为空！", "警告");
                    return;
                }
                Utils.CreateDocumentFieldDef(this.documentDefId, _name, _desc);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "警告");
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
